package com.pattern.adapter;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.util.Iterator;
import java.util.Vector;

import org.junit.Test;

public class EnumerationIteratorTest {
	@Test
	public void testIterator() {
		Vector<Integer> vector = new Vector<Integer>();

		vector.add(1);
		vector.add(2);
		vector.add(3);

		int sum = 0;
		Iterator<Integer> it = new EnumerationIterator<Integer>(
				vector.elements());
		while (it.hasNext()) {
			sum += it.next();
		}

		assertThat(sum, is(6));
	}
}
